package com.power.project.api;

import cn.hutool.core.lang.tree.Tree;
import com.power.common.domain.ResponseDTO;
import com.power.project.model.Ww_depart;
import com.power.project.model.Ww_depart_user;
import com.power.project.model.Ww_user;
import com.power.project.model.bo.DepartLeaderSetBO;
import com.power.project.model.bo.DepartSaveuserBO;
import com.power.project.model.bo.DepartmentSaveBO;
import com.power.project.model.bo.DepartmentSortBO;
import com.power.project.model.vo.DepartLeaderForSetVO;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 企业微信部门信息 Feign
 */
@Validated
public interface IWw_departFeign {

    /**
     * 查看部门树
     *
     * @param tenantId 租户id
     */
    @GetMapping("/ww_depart/tree")
    ResponseDTO<List<Tree<String>>> tree(@RequestParam("tenantId")
                                          @NotEmpty @NotNull String tenantId);

    /**
     * 查看部门人员树
     *
     * @param tenantId 租户id
     */
    @GetMapping("/ww_depart/departUserTree")
    ResponseDTO<List<Tree<String>>> departUserTree(@RequestParam("tenantId")
                                                   @NotEmpty @NotNull String tenantId);

    /**
     * 删除部门
     *
     * @param departId 部门id
     */
    @PostMapping("/ww_depart/delete")
    ResponseDTO<Void> delete(@RequestParam("departId") String departId);

    /**
     * 新增部门信息
     */
    @PostMapping("/ww_depart/save")
    ResponseDTO<Void> save(@Valid @RequestBody DepartmentSaveBO saveBO);

    /**
     * 仅修改部门名称
     */
    @PostMapping("/ww_depart/rename")
    ResponseDTO<Void> rename(@Valid @RequestBody DepartmentSaveBO saveBO);

    /**
     * 拖拽移动部门
     * 默认不会跨租户移动部门
     */
    @PostMapping("/ww_depart/sort")
    ResponseDTO<Void> sort(@Valid @RequestBody DepartmentSortBO sortBO);

    /**
     * 根据父部门查询子部门id
     * @param parentId 部门id
     */
    @GetMapping("/ww_depart/querychildrn")
    ResponseDTO<List<Ww_depart>>  querychildrn(@RequestParam("parentId") String parentId);

    /**
     * 部门关联人员
     * @param saveuserBO
     * @return
     */
    @PostMapping("/ww_depart/departmentUsers")
    ResponseDTO<Void> departmentUsers(@Valid @RequestBody DepartSaveuserBO saveuserBO);

    /**
     * 查询不在当前部门的人员
     * @param departId
     * @return
     */
    @GetMapping("/ww_depart/queryUsers")
    ResponseDTO<List<Ww_user>> queryUsers(@RequestParam("departId") String departId);



    /**
     * 查看该部门下所有人员，同时返回是否为负责人
     *
     * @param departId 部门id
     */
    @GetMapping("/ww_depart/leaderList")
    ResponseDTO<List<DepartLeaderForSetVO>> leaderList(@RequestParam("departId") String departId);

    /**
     * 多选设置部门负责人
     */
    @PostMapping("/ww_depart/setleader")
    ResponseDTO<Void> setLeader(@Valid @RequestBody DepartLeaderSetBO setBO);
}
